package com.zhuiyun.project.api.video.publishVideo.mapper;

import com.zhuiyun.project.api.video.publishVideo.entity.Video;
import com.zhuiyun.project.api.video.publishVideo.model.PublishVideoModel;
import com.zhuiyun.project.common.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName publishVideoMapper
 * @Description 上传视频管理
 * @Author qsh
 * @Date 2023/12/13 20:30
 **/
public interface PublishVideoMapper extends BaseMapper<Video> {
    //未推荐视频
    @Select("<script>" +
                "select * from video where identifying='a' and bind_video=0 and is_delete=1" +
                "<if test=\"publishVideoModel.videoId != null and publishVideoModel.videoId != ''\">" +
                "and video_id LIKE CONCAT('%',#{publishVideoModel.videoId},'%') </if>" +

                "<if test=\"publishVideoModel.videoTopic != null and publishVideoModel.videoTopic != ''\">" +
                "and video_topic LIKE CONCAT('%',#{publishVideoModel.videoTopic},'%') </if>" +

                "<if test=\"publishVideoModel.userAccount != null and publishVideoModel.userAccount != ''\">" +
                "and user_account LIKE CONCAT('%',#{publishVideoModel.userAccount},'%') </if>" +

                "<if test=\"publishVideoModel.videoStatus != null and publishVideoModel.videoStatus != ''\">" +
                "and video_status LIKE CONCAT('%',#{publishVideoModel.videoStatus},'%') </if>" +

                "<if test=\"publishVideoModel.auditStartTime != null and publishVideoModel.auditEndTime != null\">" +
                "and audit_time BETWEEN #{publishVideoModel.auditStartTime} and #{publishVideoModel.auditEndTime} </if>" +

                "<if test=\"publishVideoModel.UploadStartTime != null and publishVideoModel.UploadEndTime != null\">" +
                "and creation_time BETWEEN #{publishVideoModel.UploadStartTime} and #{publishVideoModel.UploadEndTime} </if>" +
            "</script>")
    List<PublishVideoModel> getPublishVideo(@Param("publishVideoModel") PublishVideoModel publishVideoModel);

    //已推荐视频
    @Select("<script>" +
            "select * from video where identifying='a' and bind_video=1 and is_delete=1" +
            "<if test=\"publishVideoModel.videoId != null and publishVideoModel.videoId != ''\">" +
            "and video_id LIKE CONCAT('%',#{publishVideoModel.videoId},'%') </if>" +

            "<if test=\"publishVideoModel.videoTopic != null and publishVideoModel.videoTopic != ''\">" +
            "and video_topic LIKE CONCAT('%',#{publishVideoModel.videoTopic},'%') </if>" +

            "<if test=\"publishVideoModel.userAccount != null and publishVideoModel.userAccount != ''\">" +
            "and user_account LIKE CONCAT('%',#{publishVideoModel.userAccount},'%') </if>" +

            "<if test=\"publishVideoModel.videoStatus != null and publishVideoModel.videoStatus != ''\">" +
            "and video_status LIKE CONCAT('%',#{publishVideoModel.videoStatus},'%') </if>" +

            "<if test=\"publishVideoModel.auditStartTime != null and publishVideoModel.auditEndTime != null\">" +
            "and audit_time BETWEEN #{publishVideoModel.auditStartTime} and #{publishVideoModel.auditEndTime} </if>" +

            "<if test=\"publishVideoModel.UploadStartTime != null and publishVideoModel.UploadEndTime != null\">" +
            "and creation_time BETWEEN #{publishVideoModel.UploadStartTime} and #{publishVideoModel.UploadEndTime} </if>" +
            "</script>")
    List<PublishVideoModel> getPublishVideoT(@Param("publishVideoModel") PublishVideoModel publishVideoModel);

    //已下架视频
    @Select("<script>" +
            "select * from video where identifying='a' and is_delete=0" +
            "<if test=\"publishVideoModel.videoId != null and publishVideoModel.videoId != ''\">" +
            "and video_id LIKE CONCAT('%',#{publishVideoModel.videoId},'%') </if>" +

            "<if test=\"publishVideoModel.videoTopic != null and publishVideoModel.videoTopic != ''\">" +
            "and video_topic LIKE CONCAT('%',#{publishVideoModel.videoTopic},'%') </if>" +

            "<if test=\"publishVideoModel.userAccount != null and publishVideoModel.userAccount != ''\">" +
            "and user_account LIKE CONCAT('%',#{publishVideoModel.userAccount},'%') </if>" +

            "<if test=\"publishVideoModel.videoStatus != null and publishVideoModel.videoStatus != ''\">" +
            "and video_status LIKE CONCAT('%',#{publishVideoModel.videoStatus},'%') </if>" +

            "<if test=\"publishVideoModel.auditStartTime != null and publishVideoModel.auditEndTime != null\">" +
            "and audit_time BETWEEN #{publishVideoModel.auditStartTime} and #{publishVideoModel.auditEndTime} </if>" +

            "<if test=\"publishVideoModel.UploadStartTime != null and publishVideoModel.UploadEndTime != null\">" +
            "and creation_time BETWEEN #{publishVideoModel.UploadStartTime} and #{publishVideoModel.UploadEndTime} </if>" +
            "</script>")
    List<PublishVideoModel> getPublishVideoX(@Param("publishVideoModel") PublishVideoModel publishVideoModel);
}
